package com.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDate;

/**
 * 学生住宿
 *
 * @TableName student_dorm
 */
@TableName(value = "student_dorm")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class StudentDorm extends CommonProperty implements Serializable {
    /**
     * 学生id
     */
    @TableField(value = "student_id")
    private Long studentId;

    /**
     * 宿舍id
     */
    @TableField(value = "dorm_id")
    private String dormId;

    /**
     * 床位id
     */
    @TableField(value = "bed_id")
    private String bedId;

    /**
     * 入住时间
     */
    @TableField(value = "checkin_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)
    private LocalDate checkinTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}